import config from './config.js'

export default function request({
    // 解构参数
    url,
    method = 'GET',
    data = {},
    timeout = 60000,
    dataType = 'json'
}) {
    return new Promise((resolve, reject) => {
        uni.request({
            url: config.dev + url,
            method,
            data,
            timeout,
            dataType,
            success(res) {
                resolve(res.data)
            },
            fail(error) {
                reject(error)
            }
        })
    })
}